(function() {
// Localize jQuery variable
var jQuery,
_domain = document.domain;
/******** Load jQuery if not present *********/
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.7.1') {
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src","https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
// var script_tag_tmpl = document.createElement('script');
// script_tag_tmpl.setAttribute("type","text/javascript");
// script_tag_tmpl.setAttribute("src","https://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js");
if (script_tag.readyState) {
script_tag.onreadystatechange = function () { // For old versions of IE
if (this.readyState == 'complete' || this.readyState == 'loaded') {
scriptLoadHandler();
}
};
} else {
script_tag.onload = scriptLoadHandler;
}
// Try to find the head, otherwise default to the documentElement
(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
// (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag_tmpl);
} else {
// The jQuery version on the window is the one we want to use
jQuery = window.jQuery;
main();
}
/******** Called once jQuery has loaded ******/
function scriptLoadHandler() {
// Restore $ and window.jQuery to their previous values and store the
// new jQuery in our local jQuery variable
jQuery = window.jQuery.noConflict(true);
// Call our main function
main();
}
/******** Our main function ********/
function main() {
var ResultsLib = (function () {
var pub={},_apir="https://alaska-api.athlinks.com/",_badgePath="",_isStartlistLoad=false,_view="",_mode='o';_classid='';_hasPhotos=true,_isResLoad=false,_isRaceLoad=false,_Millisecond=10,_Second=1e3,_Minute=6e4,_Hour=36e5,_Day=864e5,_race=undefined,_affid=0,_spid="",_raceid=0,_courseid=0,_coursename='',_colspan=10,_cpid=0,_cpname="",_pageSize=100,_page=1,_gender="m",_term="",_entryid=0,_strPaging=undefined,_msgLoading='
',_pageContent='';
pub.Setup=function(){jQuery("#athlinks-raceresult-widget").html(_pageContent)}
pub.GetRaceList = function (affid,y,a,m,c) {
_affid = affid;
_y = 2024,
_gender = "a",
_page = 1,
_term = '',
_classid = c,
_mode = m;
var hasResults = 1;
Inject("athlinks-race-info","");
Inject("athlinks-results-info","");
Inject("athlinks-fields","");
jQuery("#resTbl").css({opacity:.25});
var results = '
',
cY = 0;
var url = _apir + "Groups/Races/" + _affid + "?page=1&pagesize=256&startdate=1/1/"+ (a===true?_y:1753) +"&enddate=12/31/" + (a===true?_y:2999) + "&key=d0c905b661437f44a9fa47b6ebd2af6b&hasresults=" + hasResults + "&stateprov=&country=&format=json&callback=?";
jQuery.getJSON(url,function(data){
jQuery.each(data.List, function(index, value){
var y = new Date(parseInt(this.RaceDate.substr(6))).getFullYear();
var link = ( new Date(parseInt(this.RaceDate.substr(6))) > new Date() ) ? "Check back for results." : (this.ResultCount > 0 ? this.ResultCount + " Results" : "Results Pending");
if(cY!==y){cY=y;results+='
'}return f}
pub.TicksToTime=function(a,b){var c=0,d=0,e=0,f=0,g=0,h="";a=Math.floor(a);c=GetDayInTicks(a);a=a-c*_Day;d=GetHourInTicks(a);a=a-d*_Hour;e=GetMinuteInTicks(a);a=a-e*_Minute;f=GetSecondInTicks(a);a=a-f*_Second;g=GetMSInTicks(a);a=a-g*_Millisecond;if(g===100){g=0;f+=1}if(f===60){f=0;e+=1}if(e===60){e=0;d+=1}if(d===24){d=0;c+=1}if(c>0){h+=("0"+c).substr(0,2)+":"}if(d>0||c>0){if(d<10){h+=d+":"}else{h+=("0"+d).substr(0,2)+":"}}if(a>_Minute*5){h+=zeroPad(e,2)+":"+zeroPad(f,2)}else{h+=zeroPad(e,2)+":"+zeroPad(f,2);if(g!=0&&b===true){h+="."+g}}return h}
pub.SafeHash=function(a,b){return a===undefined?b:a}
pub.TabIt2=function(a){jQuery(a).each(function(){var a,b,c=jQuery(this).find("a");a=jQuery(c.filter('[href="'+location.hash+'"]')[0]||c[0]);a.addClass("active");b=jQuery(a.attr("href"));c.not(a).each(function(){jQuery(jQuery(this).attr("href")).hide()});jQuery(this).delegate("a","click",function(c){a.removeClass("active");b.hide();a=jQuery(this);b=jQuery(jQuery(this).attr("href"));a.addClass("active");b.show();c.preventDefault()})})}
// onError event handler
function onError(event) {
alert('An error has occured' + ': ' + event.errorCode + '; ' + event.errorMessage);
}
function parseGender(val) {
switch(val){
case 'M':
return 'Male';
case 'F':
return 'Female';
default:
return 'Unspecified';
}
}
// onSendDone event handler.
// Displays in the status field, the list of providers to which the newsfeed has been
// successfully published.
function onSendDone(event)
{
document.getElementById('status').style.color = "green";
switch(event.context)
{
case 'multiSelect':
document.getElementById('status').innerHTML = 'The newsfeed has been posted to: ' + event.providers;
break;
case 'simpleShare':
document.getElementById('status').innerHTML = 'Clicked ' + event.providers;
break;
default:
document.getElementById('status').innerHTML = 'Share onSendDone' ;
}
}
function Place(p){
p = Math.floor(p);
switch(p){
case 10:
case 11:
case 12:
case 13:
return p + 'th';
}
p = ''+p;
switch(p.substring(p.length-1)){
case "1":
return p+'st';
case "2":
return p+'nd';
case "3":
return p+'rd';
default:
return p+'th';
}
return p;
}
function DrawClaimED(z,a,b,c, meid, evid, ecid, bib){return '
";return rows}
function RenderGrad(a){var b="",c="",d="",e=parseInt(a<50?"00":"cc",16),f=parseInt(a<50?"aa":"00",16),g=parseInt(a<50?"00":"00",16),h=parseInt(a<50?"ff":"ff",16),i=parseInt(a<50?"cc":"cc",16),j=parseInt(a<50?"33":"33",16),k="",l="",m="";if(a>=50){a=100-a;k=Math.round(Math.abs(e-h)*.01*a*2),l=Math.round(Math.abs(f-i)*.01*a*2),m=Math.round(Math.abs(g-j)*.01*a*2)}else{a=a*2;k=Math.round(Math.abs(e-h)*.01*a),l=Math.round(Math.abs(f-i)*.01*a),m=Math.round(Math.abs(g-j)*.01*a)}b=GetColor(e>h?e-k:e+k);c=GetColor(f>i?f-l:f+l);d=GetColor(g>j?g-m:g+m);return"#"+b+c+d}
function GetColor(a){if(a<16){return"0"+a.toString(16)}return a.toString(16)}
function RaceURL(a,b){return a.replace("%%raceid%%",b)}
function StarterLink(a,b,c){return b===true?a:'
'+a+"
"}
function RacerLink(a,b,c,d){return b===true?a:''+a+""}
function GenerateCourseList(a,b){var c="";jQuery.each(a.Courses,function(a,d){c+='"});return'"}
function Inject(a,b){jQuery("#"+a).html(b)}
function FormatJSONDate(jsonDate,mode){mode=mode===undefined?"t":mode;var date=eval(jsonDate.replace(/\/Date\((\d+(-\d+)?)\)\//gi,"new Date($1)"));switch(mode){case"f":return dateFormat(date,"ddd, mmm ddS, yyyy");case"t":return dateFormat(date,"mm/dd/yy");case"y":return dateFormat(date,"yyyy");case"m":return dateFormat(date,"mm/dd")}}
function GenerateGenderList(a){var b="";jQuery.each(a.GenderCounts,function(a,c){b+='"});return'"}
function GenerateTeamPaging(a){var b="